<template>
  <!-- 清算账户信息查询申请录入查询页面弹出框-->
  <el-dialog
    title="清算账户信息查询申请录入查询"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="false"
    @close="closeFn"
  >
    <el-form ref="settingsForm" :model="formData" :rules="rules" label-width="135px">
      <el-row type="flex" v-if="formData.rspId">
        <el-col :span="12">
          <el-form-item label="交易流水号：" prop="rspId">
            <el-input v-model="formData.rspId" placeholder="交易流水号" disabled />
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>

      <el-row>
        <el-col :span="24">
          <el-form-item label="被查询行行号：" prop="drctBankCode">
            <el-input v-model="formData.drctBankCode" placeholder="被查询行行号" disabled />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="被查询行行名：" prop="drctBankName">
            <el-input v-model="formData.drctBankName" placeholder="被查询行行名" disabled />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="24">
          <el-form-item label="发起直接参与机构：" prop="directSender">
            <el-input v-model="formData.directSender" placeholder="发起直接参与机构" disabled />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="发起直接参与机构名：" prop="directSenderName">
            <el-input v-model="formData.directSenderName" placeholder="发起直接参与机构名" disabled />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="查询方式：" prop="inqType">
            <el-select
              v-model="formData.inqType"
              placeholder="请选择"
              style="width: 100%"
              :disabled="formData.rspId ? true : false"
            >
              <el-option
                v-for="dict in dictMap.CLS_QUERYTYPE"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>

      <el-row>
        <el-col :span="24">
          <el-form-item label="附言：" prop="remarks">
            <el-input
              :disabled="formData.rspId ? true : false"
              type="textarea"
              v-model="formData.remarks"
              placeholder="备注"
              maxlength="256"
              show-word-limit
            />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button v-if="!formData.rspId" type="primary" @click="submitForm" :loading="isLoading">提交</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { save } from "@/api/cnaps/saps/clearAcctInfoQuery/clear_inquiry_entry.js";
import { log } from "util";
export default {
  name: "EnterQuery",
  components: {},
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      isControl: false,
      // 是否显示弹出层
      open: false,
      isLoading: false,
      rules: {
        inqType: [
          {
            required: true,
            message: "请选择类型",
            trigger: "change",
          },
        ],
      },
    };
  },
  mounted() {},
  methods: {
    // 表单重置
    reset() {
      this.resetForm("settingsForm");
      this.$set(this, "formData", {});
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
    },
    submitForm() {
      this.$refs["settingsForm"].validate((valid) => {
        if (valid) {
          this.isLoading = true;
          save(this.formData)
            .then((res) => {
              this.msgSuccess("提交成功！");
              this.isLoading = false;
              this.$set(this.formData, "rspId", res.result.rspId);
            })
            .catch((err) => {
              this.isLoading = false;
            });
        }
      });
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
